<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>

<f:view>
    <f:loadBundle basename="shmallarchitect.resources.ShmallResources" var="res"/>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=windows-1252"></meta>
            <title>
                <h:outputText value="#{res.title} - #{res['main.pageTitle']}"/>
            </title>
            <link href="../css/shmall.css" rel="stylesheet" media="screen"></link>
            <link rel="shortcut icon" href="../images/favicon.png">
        </head>
        <body><h:form>
                <table width="100%" border="0" >
                    <tr>
                        <td colspan="2">
                            <h1 align="center">
                                <h:graphicImage url="/images/shmall_logo.png"
                                                alt="logo"/>
                                <h:outputText value="#{res.title}" styleClass="LogoTitle"/>
                            </h1>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <h:messages infoClass="LoginSuccess" />
                            <f:subview id="mainbar">
                                <jsp:include page="mainbar.jsp"/>
                            </f:subview>
                        </td>
                    </tr>
                    <tr><td>&nbsp;</td></tr>
                    <tr>
                        <td colspan="2">
                            <h:outputText value="#{res[\'main.header\']}" styleClass="PageTitle"/>

                            <h:dataTable id="eventsTable" rows="100" value="#{MainMBean.galleriesForUser}"
                                         var="g" rowClasses="list-row-odd,list-row-even" headerClass="table-header"
                                         width="100%" binding="#{MainMBean.data}">


                                <h:column>
                                    <f:facet name="header">
                                        <h:panelGroup>
                                            <h:commandLink immediate="true">
                                                <h:outputText value="#{res[\'main.galleryName\']}"/>
                                            </h:commandLink>
                                        </h:panelGroup>
                                    </f:facet>
                                    <h:outputText value="#{g.name}"/>
                                </h:column>

                                <h:column>
                                    <f:facet name="header">
                                        <h:panelGroup>
                                            <h:commandLink immediate="true" >
                                                <h:outputText value="#{res[\'main.location\']}"/>
                                            </h:commandLink>
                                        </h:panelGroup>
                                    </f:facet>
                                    <!-- renderer param does not work :( -->
                                    <h:outputText rendered="#{(g.country != null) && (g.country != \"\")}" value="#{g.country}, #{g.city}"/>
                                </h:column>

                                <h:column>
                                    <f:facet name="header">
                                        <h:panelGroup>
                                            <h:commandLink immediate="true" >
                                                <h:outputText value="#{res[\'main.address\']}"/>
                                            </h:commandLink>
                                        </h:panelGroup>
                                    </f:facet>
                                    <!-- renderer param does not work :( -->
                                    <h:outputText rendered="#{(g.street != null) && (g.number != \"\")}" value="#{g.street}, #{g.number}"/>
                                </h:column>

                                <h:column>
                                    <f:facet name="header">
                                        <h:panelGroup>
                                            <h:commandLink immediate="true" >
                                                <h:outputText value="#{res[\'main.owner\']}"/>
                                            </h:commandLink>
                                        </h:panelGroup>
                                    </f:facet>
                                    <h:outputText value="#{g.owner.name}"/>
                                </h:column>

                                <h:column>
                                    <f:facet name="header">
                                        <h:panelGroup>
                                            <h:commandLink immediate="true" >
                                                <h:outputText value="#{res[\'main.email\']}"/>
                                            </h:commandLink>
                                        </h:panelGroup>
                                    </f:facet>
                                    <h:outputText value="#{g.owner.email}"/>
                                </h:column>

                            </h:dataTable>

                        </td>
                    </tr>
                    <tr><td><f:verbatim><BR></f:verbatim></td></tr>
                    <tr>
                        <td>
                            <h:selectOneMenu id="selectGallery" value="#{MainMBean.selectedGallery}" styleClass="NiceSelectOne">
                                <f:selectItems value="#{MainMBean.galleryOptions}" />
                            </h:selectOneMenu>
                            <h:commandButton value="#{res[\'main.viewButton\']}" styleClass="NiceButton" action="view"/>
                            <h:commandButton value="#{res[\'main.editButton\']}" styleClass="NiceButton" action="edit"/>

                        </td>
                        <td align="right">
                            <h:commandButton value="#{res[\'main.createButton\']}" styleClass="NiceButton" action="create" />
                        </td>
                    </tr>
                    <tr>
                        <td colspan="2">
                            <f:subview id="creditsbar">
                                <jsp:include page="../creditsbar.jsp"/>
                            </f:subview>
                        </td>
                    </tr>
                </table>
        </h:form></body>
    </html>
</f:view>